package com.czk.stream;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Author:ChenZhangKun
 * @Date: 2022/9/9 20:37
 */
public class StreamFlatMap {
    public static void main(String[] args) {
        List<String> sentences = Arrays.asList("hello world", "Jia Gou Wu Dao");
        List<String> stringList = sentences.stream().flatMap(x -> Arrays.stream(x.split(" "))).collect(Collectors.toList());
        System.out.println(stringList);
    }
}
